package data;

/** Contains all Regular Expression (regex) getter methods, 
 *  in order to check the input of an user / admin
 * @author Matthias
 *
 */
public class RegexInput {

	/**
	 * 
	 */
	public RegexInput(){}
	
	/** Regex method for checking if letters match
	 * @param letters
	 * @return
	 */
	public boolean forLetters(final String letters) {
		return letters.matches("^[a-zA-Z\\s]+$");
	}
	
	/** Regex method for StreetNr
	 * @param digits
	 * @return
	 */
	public boolean isStreetNr(final String streetNr) {
		return streetNr.matches("^[0-9,a-zA-Z\\s]+$");
	}

	/** Regex method for checking for 8 digits match
	 * @param digits
	 * @return
	 */
	public boolean isEightDigits(final String digits) {
		return digits.matches("^[0-9]{8}$");
	}
	
	/** Checking if the input has 6 digits
	 * @param digits
	 * @return
	 */
	public boolean isSixDigits(final String digits) {
		return digits.matches("^[0-9]{6}$");
	}
		
	/** Regex method for TelNr
	 * @param telnr
	 * @return
	 */
	public final boolean isTelNr (final String telnr) {
		return telnr.matches("^[0-9]{8,15}$");
	}
	
	/** Regex method for pin
	 * @param pin
	 * @return
	 */
	public final boolean isPin(final String pin) {
		return pin.matches("^*[0-9]{4}$");
	}
	
	/** Regex method for Zipcode
	 * @param zip
	 * @return
	 */
	public final boolean isZip(final String zip) {
		return zip.matches("^[0-9]{4,5}$"); 
	}
	
	/** Regex method for City
	 * @param city
	 * @return 
	 */
	public boolean isCity (final String city) {
		return city.matches("^*[A-Za-z\\s]$");
	}

}